<!DOCTYPE html>
<html lang="zh-CN">
<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>CloudLinker - C++后端服务器框架</title>
    <style>
        :root {
            --primary-color: #2c3e50;
            --secondary-color: #3498db;
            --background-color: #f8f9fa;
            --text-color: #333;
        }
        
        * {
            margin: 0;
            padding: 0;
            box-sizing: border-box;
        }
        
        body {
            font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
            line-height: 1.6;
            color: var(--text-color);
            background-color: var(--background-color);
        }
        
        .container {
            max-width: 1200px;
            margin: 0 auto;
            padding: 20px;
        }
        
        header {
            background-color: var(--primary-color);
            color: white;
            padding: 2rem 0;
            margin-bottom: 2rem;
            text-align: center;
        }
        
        h1, h2, h3 {
            color: var(--primary-color);
            margin: 1.5rem 0 1rem;
        }
        
        header h1 {
            color: white;
            font-size: 2.5rem;
        }
        
        .section {
            background: white;
            padding: 2rem;
            margin-bottom: 2rem;
            border-radius: 8px;
            box-shadow: 0 2px 4px rgba(0,0,0,0.1);
        }
        
        .feature-grid {
            display: grid;
            grid-template-columns: repeat(auto-fit, minmax(300px, 1fr));
            gap: 2rem;
            margin: 2rem 0;
        }
        
        .feature-item {
            padding: 1.5rem;
            background: #f8f9fa;
            border-radius: 6px;
            border-left: 4px solid var(--secondary-color);
            transition: transform 0.3s ease;
        }
        
        .feature-item:hover {
            transform: translateY(-5px);
        }
        
        code {
            background: #f4f4f4;
            padding: 0.2rem 0.4rem;
            border-radius: 4px;
            font-family: 'Courier New', Courier, monospace;
        }
        
        pre {
            background: #2d2d2d;
            color: #f8f8f2;
            padding: 1rem;
            border-radius: 4px;
            overflow-x: auto;
            margin: 1rem 0;
        }
        
        ul {
            list-style-position: inside;
            margin: 1rem 0;
        }
        
        .module-list {
            display: grid;
            grid-template-columns: repeat(auto-fit, minmax(250px, 1fr));
            gap: 1rem;
            margin: 1rem 0;
        }
        
        .module-item {
            background: white;
            padding: 1rem;
            border-radius: 6px;
            border: 1px solid #ddd;
            transition: box-shadow 0.3s ease;
        }
        
        .module-item:hover {
            box-shadow: 0 5px 15px rgba(0,0,0,0.1);
        }
        
        .btn {
            display: inline-block;
            background: var(--secondary-color);
            color: white;
            padding: 0.8rem 1.5rem;
            border-radius: 4px;
            text-decoration: none;
            margin-top: 1rem;
            transition: background 0.3s ease;
        }
        
        .btn:hover {
            background: #2980b9;
        }
        
        .code-example {
            margin: 2rem 0;
        }
        
        .highlight {
            color: var(--secondary-color);
            font-weight: bold;
        }
    </style>
</head>
<body>
    <header>
        <div class="container">
            <h1>CloudLinker</h1>
            <p>高性能C++后端服务器框架，专为现代Web应用设计</p>
            <a href="#get-started" class="btn">快速开始</a>
        </div>
    </header>

    <div class="container">
        <section class="section">
            <h2>为什么选择CloudLinker？</h2>
            <p>CloudLinker是一个基于<span class="highlight">Poco框架</span>开发的模块化C++框架，提供了完整的后端服务器解决方案。该框架采用现代<span class="highlight">C++17标准</span>，结合了高性能和开发效率，是构建企业级应用的理想选择。</p>
        </section>

        <section class="section">
            <h2>核心特性</h2>
            <div class="feature-grid">
                <div class="feature-item">
                    <h3>🚀 高性能路由</h3>
                    <p>提供类似Express框架的路由系统，支持RESTful API设计，包括标准路由和正则表达式路由。</p>
                    <pre><code class="language-cpp">router.Get("/api/users/:id", [](RequestContext& ctx) {
    int userId = std::stoi(ctx.getParam("id"));
    // 处理用户请求
});</code></pre>
                </div>div>
                <div class="feature-item">
                    <h3>🔌 中间件系统</h3>
                    <p>灵活的中间件机制，支持请求处理的链式调用，轻松实现认证、日志等功能。</p>
                    <pre><code class="language-cpp">router.addMiddleware([](RequestContext& ctx) {
    // 认证检查
    if (!checkAuth(ctx)) {
        return false; // 中断请求
    }
    return true;
});</code></pre>
                </div>
                <div class="feature-item">
                    <h3>💾 数据库集成</h3>
                    <p>基于Poco的ActiveRecord实现，提供强大的ORM功能，简化数据库操作。</p>
                    <pre><code class="language-cpp">User user;
user.set("name", "张三");
user.set("email", "zhangsan@example.com");
user.save();</code></pre>
                </div>
                <div class="feature-item">
                    <h3>🔒 安全特性</h3>
                    <p>内置SSL/TLS支持、JWT认证、权限管理系统，确保应用安全性。</p>
                    <pre><code class="language-cpp"></code>// JWT验证
auto token = JWT::create()
    .setIssuer("CloudLinker")
    .setSubject("user123")
    .sign(HS256{"secret"});</code></pre>
                </div>
            </div>
        </section>

        <section id="get-started" class="section">
            <h2>快速开始</h2>
            
            <div class="code-example">
                <h3>1. 创建简单服务器</h3>
                <pre><code class="language-cpp">#include "CLink/Server/Server.h"
#include "CLink/Router/Router.h"

int main() {
    Server server(8080); // 监听8080端口
    Router& router = Router::GetInstance();
    
    // 添加路由
    router.Get("/", [](RequestContext& ctx) {
        ctx.response().setContentType("text/plain");
        ctx.response() << "Hello, CloudLinker!";
    });
    
    server.start(); // 启动服务器
    return 0;
}</code></pre>
            </div>
            
            <div class="code-example">
                <h3>2. 使用中间件</h3>
                <pre><code class="language-cpp">// 日志中间件
router.addMiddleware([](RequestContext& ctx) {
    std::cout << "[LOG] " << ctx.request().getURI() << std::endl;
    return true; // 继续处理
});

// 认证中间件
router.addMiddleware([](RequestContext& ctx) {
    if (!ctx.hasHeader("Authorization")) {
        ctx.response().setStatus(HTTPResponse::HTTP_UNAUTHORIZED);
        return false; // 中断请求
    }
    return true;
});</code></pre>
            </div>
            
            <div class="code-example">
                <h3>3. 处理JSON请求</h3>
                <pre><code class="language-cpp">router.Post("/api/users", [](RequestContext& ctx) {
    try {
        auto json = ctx.request().getJSON();
        User user;
        user.set("name", json["name"].toString());
        user.set("email", json["email"].toString());
        user.save();
        
        ctx.response().setJSON({
            {"success", true},
            {"userId", user.get("id")}
        });
    } catch (const Exception& e) {
        ctx.response().setStatus(HTTPResponse::HTTP_BAD_REQUEST);
        ctx.response() << e.what();
    }
});</code></pre>
            </div>
        </section>

        <section class="section">
            <h2>构建与运行</h2>
            <h3>依赖要求</h3>
            <ul>
                <li>C++17兼容编译器 (GCC 7+, Clang 5+, MSVC 2017+)</li>
                <li>CMake 3.10+</li>
                <li>Poco框架 (1.9.0+)</li>
            </ul>
            
            <h3>构建步骤</h3>
            <pre><code class="language-bash"># 克隆仓库
git clone https://github.com/your-repo/CloudLinker.git
cd CloudLinker

# 创建构建目录
mkdir build && cd build

# 生成构建系统
cmake ..

# 编译
cmake --build .

# 运行示例
./bin/cloudlinker-example</code></pre>
        </section>

        <section class="section">
            <h2>模块架构</h2>
            <div class="module-list">
                <div class="module-item">
                    <h3>Server</h3>
                    <ul>
                        <li>HTTP服务器核心</li>
                        <li>请求/响应处理</li>
                        <li>多线程支持</li>
                    </ul>
                </div>
                <div class="module-item">
                    <h3>Router</h3>
                    <ul>
                        <li>路由匹配</li>
                        <li>中间件系统</li>
                        <li>参数解析</li>
                    </ul>
                </div>
                <div class="module-item">
                    <h3>Models</h3>
                    <ul>
                        <li>数据库模型</li>
                        <li>ORM映射</li>
                        <li>查询构建器</li>
                    </ul>
                </div>
                <div class="module-item">
                    <h3>Utils</h3>
                    <ul>
                        <li>JSON处理</li>
                        <li>JWT支持</li>
                        <li>加密工具</li>
                    </ul>
                </div>
            </div>
        </section>

        <section class="section">
            <h2>了解更多</h2>
            <p>查看我们的文档和示例代码，开始构建您的下一个高性能后端服务。</p>
            <a href="#" class="btn">文档</a>
            <a href="#" class="btn">示例代码</a>
            <a href="#" class="btn">GitHub仓库</a>
        </section>
    </div>
</body>
</html>